<%@ page language="java" contentType="text/html; charset=UTF-8"
	isELIgnored="false" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<%@ taglib uri="/mytag" prefix="yjd"%>
<div class="wrap">
	<div class="h_a">搜索</div>
	<div class="search_type cc mb10">
		<form method="get" action='<yjd:url url="/db/biTableInfo/list"/>' autocomplete="off">
			<label>表名：</label>
			<input name="table_name" type="text" class="input length_4 mr10" value="${param.table_name }"	placeholder="表名">
			<label>所属数据库：</label>
			<select	name="database_info_id" class="mr10">
				<option value="">全部</option>
				<c:forEach items="${requestScope.biDatabaseInfoModels }" var="item">
				<option ${param.database_info_id==item.id?"selected='selected'":"" } value="${item.id }">${item.title }</option>
				</c:forEach>
			</select>
			<button type="submit" class="btn btn_red">搜索</button>
		</form>
	</div>
	<div class="mb10">
		<a class="btn" href="<yjd:url url="/db/biTableInfo/add"/>"><span class="add"></span>添加</a>
	</div>
	<!-- 列表 -->
	<c:set var="hashData" value="${pager.pagerModel.dataList!=null && fn:length(pager.pagerModel.dataList)>0 }" />
	<div class="table_list">
		<table width="100%">
			<thead>
				<tr>
					<td width="60">ID</td>
					<td>数据源</td>
					<td>表名</td>
					<td>主键</td>
					<td>备注</td>
					<td>操作 </td>
				</tr>
			</thead>
			<c:if test="${hashData }">
			<tbody>
			<c:forEach items="${pager.pagerModel.dataList }" var="item">
				<tr>
					<td>${item.id }</td>
					<td>${requestScope.biDatabaseInfoMap[item.database_info_id].title }</td>
					<td>${item.table_name }</td>
					<td>${item.pk_field_name }</td>
					<td>${item.description }</td>
					<td>
					<c:if test="${!(item.database_info_id eq 1) }">
						<a href="<yjd:url url="/db/biTableInfo/transfer"/>?tablename=${item.table_name}&schema=${requestScope.biDatabaseInfoMap[item.database_info_id].code }" class="btn btn_orange J_ajax_del" data-msg="您确定重新导入数据?" id="J_ajax_del_${item.id }">数据导入</a>
					</c:if>
						<a href="<yjd:url url="/db/biTableInfo/edit/${item.id }"/>" class="btn mr10">编辑</a>
						<a href="<yjd:url url="/db/biTableInfo/delete/${item.id }"/>" class="btn J_ajax_del" data-msg="您确定删除该数据?" id="J_ajax_del_${item.id }">删除</a>
					</td>
				</tr>
			</c:forEach>
			</tbody>
			</c:if>
		</table>
	</div>
	<!-- 分页 -->
	<%@ include file="../../public/pager/pager.pagination.jsp" %>
</div>
<script>
	YJD.use('AppAdminCommon');
</script>